/* 获取七牛云token */
import { ElMessage } from 'element-plus';
import { api } from '@/utils/api.js';
/* 此时我就需要返回的是Promise 对象 */
export default function useResourceToken (suffix, uploadData) {
  /* 获取七牛云token */
  return api.getUploadToken({ suffix })
    .then((res) => {
      if (res.status === 1) {
        uploadData.token = res.result.upToken;
        uploadData.key = res.result.fileName[0];
      } else {
        ElMessage.error(res.msg);
      }
    })
    .catch((res) => {
    });
}
